package edu.sctu.practice.class02.hujie.cgs.practice02.test03;

/**
 * Created by Administrator on 2015/10/18 0018.
 */
public class MyTime {
    //三个整形成员
    private int hour;
    private int minute;
    private int second;

    //静态
    public void MyTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    //diaplay的方法
    public void display() {
        System.out.println("当前的时间是：" + hour + ":" + minute + ":" + second);
    }

    public void addSecond(int sec) {
        second = sec + second;
        System.out.println("秒的加");
    }

    public void addMinute(int min) {
        minute = min + minute;
        System.out.println("分的加");
    }

    public void addHour(int hou) {
        hour = hou + hour;
        System.out.println("时的加");
    }

    public void subSecond(int sec) {
        second = sec + second;
        System.out.println("秒的减");
    }

    public void subMinute(int min) {
        minute = min + minute;
        System.out.println("分的减");
    }

    public void subHour(int hou) {
        hour = hou + hour;
        System.out.println("时的减");
    }

    public void check() {
        if (hour <= 24 & hour >= 0 & minute <= 60 & minute >= 0 & second <= 60 & second >= 0) {
            System.out.println("这是符合规定的时间");
        } else {
            System.out.println("这是不符合规定的时间");
        }
    }

    public static void main(String[] args) {
        MyTime myTime = new MyTime();
        myTime.addHour(2);
        myTime.addMinute(4);
        myTime.addSecond(3);
        myTime.subHour(2);
        myTime.subMinute(3);
        myTime.subSecond(1);
        myTime.display();
        myTime.check();
    }
}
